package com.snack.shop.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;

/**
 * 订单商品明细实体
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_order_item")
@Schema(description = "订单商品明细表")
public class OrderItem extends BaseEntity {

    @Schema(description = "订单ID")
    @TableField("order_id")
    @JsonProperty("orderId")
    private Long orderId;

    @Schema(description = "商品ID")
    @TableField("product_id")
    @JsonProperty("productId")
    private Long productId;

    @Schema(description = "商品名称")
    @TableField("product_name")
    @JsonProperty("productName")
    private String productName;

    @Schema(description = "商品图片")
    @TableField("product_image")
    @JsonProperty("productImage")
    private String productImage;

    @Schema(description = "商品价格")
    private BigDecimal price;

    @Schema(description = "购买数量")
    private Integer quantity;

    @Schema(description = "小计金额")
    private BigDecimal subtotal;
}

